<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>再融资合同管理列表</title>
	<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div class="searchArea">
			<form id="searchBar">
				<div class="fieldset1 clearFix">
					<div class="fieldBox">
						<div class="label">项目名称</div>
						<div class="field">
							<input name="fncPrjNm" id="fncPrjNm" type="text" class="ui-textbox" value="" >
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">项目编号</div>
						<div class="field">
							<input name="fncPrjId" id="fncPrjId" type="text" class="ui-textbox" value="" >
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">金融机构</div>
               			<div class="field">
							<input name="fundRasInsNm" id="fundRasInsNm" type="text" class="ui-textbox" value="">
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">项目状态</div>
						<div class="field">
							<select name="prjStcd" id="prjStcd" ligerui="width: 160">
								<option value=" ">请选择</option>
								<c:forEach items="${prjStsList }" var="prj">
									<option value="${prj.key }">${prj.value }</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="fieldBox col_50"  style="display:none">
						<div class="label">合同状态</div>
						<div class="field">
							<select name="contStatus" id="contStatus" ligerui="width: 160">
								<option value=" ">请选择</option>
								<c:forEach items="${contStsList }" var="cont">
									<option value="${cont.key }">${cont.value }</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="fieldBox col_50" style="display:none">
						<div class="label">盖章状态</div>
						<div class="field">
							<select name="stampStatus" id="stampStatus" ligerui="width: 160">
								<option value=" ">请选择</option>
								<c:forEach items="${stampStsList }" var="stamp">
									<option value="${stamp.key }">${stamp.value }</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</div>
				
				<div class="clearFix"></div>
				
            	<div class="btnsBox">
					<span id="searchBtn" onclick="searchBtn();"  class="sq-button sq-button-round">查询</span>
					<span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
					<span id="searchBtn" onclick="loadFlow();" class="sq-button sq-button-round">流程信息</span>
					<input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
				</div>
			</form>
		</div>
	</div>
	<div id="ligergrid1" class="sq-grid"></div> 
	
	<script type="text/javascript">
		var grid = null;
		$(function () {
			$("#ligergrid1").ligerGrid({
		    	url: '<%=path%>/rfbuss/fncPrjContMain/initList.do',
		    	method : 'get',	
		        columns: [
		            { display: '项目名称', name: 'fncPrjNm', minWidth: 160 , enabledSort:true}, 
		            { display: '项目编号', name: 'fncPrjId', minWidth: 160, enabledSort:true,  
                        render: function (rowdata, rowindex, value, column) { 
	            			var h = '';
	            			if(value && value!="null"){
		            		    h+='<a href="javascript:detailBtn(';
		                        h+="'"+rowdata.prjId+"'";
		                        h+=')">'+value+'</a>';
	            			}
	                        return h;
	            		}},   
			        { display: '融资机构', name: 'fundRasInsNm', minWidth: 160, enabledSort:true}, 
		            { display: '项目状态', name: 'fncPrjStcdNm', width: 120, enabledSort:true},
		            { display: '合同份数', name: 'contNum', width: 80, enabledSort:true},
		           // { display: '合同状态', name: 'contStatusNm', width: 100 , enabledSort:true}, 
		            //{ display: '盖章状态', name: 'stampStatusNm', width: 100 , enabledSort:true}, 
		            getOptColumn()
		        ],
		        pageSize:10,
		        root:'rows',
		        record:'total',
		        hideLoadButton : true,
		        width: '100%',
		        height:'100%',
		        heightDiff:-2,
		        checkbox:true,
		        rownumbers:true
		    });
		    grid = liger.get("ligergrid1");
		    //grid.setHeight(100);
		    grid.options.isSingleCheck = true;//列表是否为单选
		    $("#searchBar").ligerForm();
		});
		
		//获取操作列
		function getOptColumn(){
			var column = {
				display: '操作',
				isSort: false,
				minWidth: 100,
				align:'left',
				render: function (rowdata, rowindex, value){
					var h="";
					 	h+='<a class="sq-button-hasicon" href="javascript:toContractView(';
                  	 	h+="'"+rowdata.prjId+"'";
	                    h+=')"><i class="sqBtnIco_4"></i>查看</a>';
					return h;
				}
			};
			return column;
		}
		
		//查询按钮事件
		function searchBtn(){
	        var form = new liger.get("searchBar");
	        var data = form.getData();
	        for (name in data){
	           grid.setParm(name,data[name]);
	        };
	       grid.reload();
		}
		
		//清空按钮事件
		function clearBtn(){
			$("#resetBtn").click();  //重置 input-text
			var form = liger.get("searchBar");
			form.setData({  //重置select等特殊表单
				"prjStcd":" ",
				"contStatus":" ",
				"stampStatus":" "
			});
		}
		
		//项目基本信息详情
		function detailBtn(id){
			Add_navTab('tab_project_detail'+id,'项目基本信息详情','<%=path%>/rfbuss/fncprjbscinfo/toDetailPage1.do?id='+id);
		}
		
		//添加合同信息
		function addContract(id){
			//回调刷新列表
			var callback = function () {
				grid.reload();
			};
			Add_navTab('tab_project_cont'+id, '添加合同', '<%=path%>/rfbuss/fncPrjContMain/toAddContPage.do?prjId='+id, callback);
		}
		
		//跳转到发起盖章流程申请页面
		function addStampFlow(id){
			//回调刷新列表
			var callback = function () {
				grid.reload();
			};
			Add_navTab('tab_stamp_flow'+id, '发起盖章流程', '<%=path%>/rfbuss/fncPrjContMain/toStampFlowPage.do?contId='+id, callback);
		}
		
		//流程信息 kfc
		function loadFlow(){
			var selectedRows = grid.getSelectedRows();
	        if (selectedRows.length != 1) {
	            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
	            return;
	        }
			$.ligerDialog.SQopen({
	            cls: 'noBorder_Dialog',
	            width: 800,
	            height:500,
	            title : '再融资合同流程信息',
	            url:'<%=path%>/rfbuss/fncPrjContMain/toContFlow.do?id='+selectedRows[0].id,
	        });
		}
		
		//查看合同信息
		function toContractView(id){
			//回调刷新列表
			var callback = function () {
				grid.reload();
			};
			Add_navTab('tab_project_cont'+id, '查看合同', '<%=path%>/rfbuss/fncPrjContMain/toContractView.do?prjId='+id, callback);
		}
		
	</script>
</body>
</html>